package com.xigege.netty.dubborpc.customer;

import com.xigege.netty.dubborpc.netty.NettyClient;
import com.xigege.netty.dubborpc.publicInterface.HelloService;

public class ClientBootstrap {
    //在这里定义协议头
    public static final String providerName = "helloServer#hello#";

    public static void main(String[] args) throws InterruptedException {
        //创建一个消费者
        NettyClient customer = new NettyClient();

        //创建代理对象
        HelloService service = (HelloService) customer.getBean(HelloService.class, providerName);

        //循环发送消息
        for (;;){
            Thread.sleep(2 * 1000);
            //通过代理对象调用服务提供者的方法（服务）
            String res = service.hello("你好dubbo");

            System.out.println("调用的结果 res = " + res);
        }

    }
}
